<?php echo $this->render('grid_header.phtml') ?>

<table class="data-grid">
    <thead>
        <tr>
            <th style="width:35px" class="br">
    <div class="sort-column">
        <span class="sort-label fl">ID</span>
        <div class="sort fr">
            <span class="asc fieldNameid" ></span>
            <span class="desc fieldNameid"></span>
        </div>
        <div class="cls"></div>
    </div>
</th>
<th class="br">
<div class="sort-column">
    <span class="sort-label fl">Tytuł</span>
    <div class="sort fr">
        <span class="asc fieldNametitle" ></span>
        <span class="desc fieldNametitle"></span>
    </div>
    <div class="cls"></div>
</div>
</th>
<th class="br">
<div class="sort-column">
    <span class="sort-label fl">Użytkownik</span>
    <div class="sort fr">
        <span class="asc fieldNamelogin" ></span>
        <span class="desc fieldNamelogin"></span>
    </div>
    <div class="cls"></div>
</div>
</th>
<th class="br">
<div class="sort-column">
    <span class="sort-label fl">Dodano</span>
    <div class="sort fr">
        <span class="asc fieldNamecreated" ></span>
        <span class="desc fieldNamecreated"></span>
    </div>
    <div class="cls"></div>
</div>
</th>
<th class="br">
<div class="sort-column">
    <span class="sort-label fl">Typ</span>
    <div class="sort fr">
        <span class="asc fieldNametyp" ></span>
        <span class="desc fieldNametyp"></span>
    </div>
    <div class="cls"></div>
</div>
</th>
<th class="br">
<div class="sort-column">
    <span class="sort-label fl">Status</span>
    <div class="sort fr">
        <span class="asc fieldNamestatus" ></span>
        <span class="desc fieldNamestatus"></span>
    </div>
    <div class="cls"></div>
</div>
</th>
<th class="br">
<div class="sort-column">
    <span class="sort-label fl">Box</span>
    <div class="sort fr">
        <span class="asc fieldNamebox" ></span>
        <span class="desc fieldNamebox"></span>
    </div>
    <div class="cls"></div>
</div>
</th>
<th>
    <span class="sort-column">Akcja</span><br>
    <span class="hidden-data">{"filterUrl":"/admin/index/content"}</span>
    <a class="ajaxFilter" href="javascript:void(0);">Filtruj</a>
    <a class="ajaxFilterClear" href="javascript:void(0);">Wyczyść</a>    
</th>
</tr>
<tr>
    <td class="br">
        <div class="ui-filter">
            <input type="text" name="filterid" class="filterField" />
            <span class="hidden-data ui-filter-value">{"value":"<?php echo $this->wparams['id'] ?>"}</span>
        </div>
    </td>
    <td class="br">
        <div class="ui-filter">
            <input type="text" name="filtertitle" class="filterField" />
            <span class="hidden-data ui-filter-value">{"value":"<?php echo $this->wparams['title'] ?>"}</span>
        </div>
    </td>
    <td class="br">
        <div class="ui-filter">
            <input type="text" name="filterlogin" class="filterField" />
            <span class="hidden-data ui-filter-value">{"value":"<?php echo $this->wparams['login'] ?>"}</span>
        </div>
    </td>
    <td class="br">
        <div class="ui-filter">
            <input type="text" name="filtercreatedod" class="filterField datepicker" />
            <span class="hidden-data ui-filter-value">{"value":"<?php echo $this->wparams['createdod'] ?>"}</span>
        </div>
        <div class="ui-filter">
            <input type="text" name="filtercreateddo" class="filterField datepicker" />
            <span class="hidden-data ui-filter-value">{"value":"<?php echo $this->wparams['createddo'] ?>"}</span>
        </div>
    </td>
    <td class="br">
        <div class="ui-filter">
            <select name="filtertyp" class="filterField">
                <option label="-----" value="-1" >-----</option>
                <?php echo Application_Model_Content::getTypOptions() ?>
            </select>
            <span class="hidden-data ui-filter-value">{"value":"<?php echo $this->wparams['typ'] ?>"}</span>
        </div>
    </td>
    <td class="br">
        <div class="ui-filter">
            <select name="filterstatus" class="filterField">
                <option label="-----" value="-1" >-----</option>
                <?php echo Application_Model_Content::getStatusOptions() ?>
            </select>
            <span class="hidden-data ui-filter-value">{"value":"<?php echo $this->wparams['status'] ?>"}</span>
        </div>
    </td>
    <td class="br">
        <div class="ui-filter">
            <select name="filterbox" class="filterField">
                <option label="-----" value="-1" >-----</option>
                <?php echo Application_Model_Content::getBoxOptions() ?>
            </select>
            <span class="hidden-data ui-filter-value">{"value":"<?php echo $this->wparams['box'] ?>"}</span>
        </div>
    </td>
    <td>

    </td>
</tr>
</thead>
<tbody>
    <?php if (count($this->paginator)): ?>
        <?php foreach ($this->paginator as $idx => $item): ?>
            <tr class="item-<?php echo $idx ?>">
                <td class="br"><?php echo $item['id'] ?></td>
                <td class="br">
                    <a class="default" href="<?php echo $this->url(array('module' => 'admin', 'action' => 'contentedit', 'id' => $item['id']), null, true) ?>">
                        <?php echo $item['title'] ?>
                    </a>
                </td>
                <td class="br"><?php echo $item['login'] ?></td>
                <td class="br"><?php echo $item['created'] ?></td>
                <td class="br"><?php echo Application_Model_Content::$typ[$item['typ']] ?></td>
                <td class="br"><?php echo Application_Model_Content::$status[$item['status']] ?></td>
                <td class="br"><?php echo Application_Model_Content::$boxes[$item['boxName']] ?></td>
                <td >
                    <a rel="<?php echo $item['id'] ?>d" class="ajax-post" href="<?php echo $this->url(array('module' => 'admin', 'action' => 'setmodel', 'id' => $item['id'], 'table' => 'content'), null, true) ?>">Usuń</a>
                    <div id="ajx-pdata-<?php echo $item['id'] ?>d" class="ajax-post-data"><?php echo Zend_Json::encode(array('status' => Application_Model_Content::S_TRASH)) ?></div>
                    <a href="<?php echo $this->url(array('module' => 'admin', 'action' => 'contentedit', 'id' => $item['id']), null, true) ?>">Edytuj</a>
                    <a href="<?php echo $this->url(array('module' => 'admin', 'action' => 'contentadd',), null, true) ?>">Dodaj</a>
                </td>
            </tr>
        <?php endforeach; ?>
    <?php endif; ?>
</tbody>
<tfoot>
    <tr>
        <td colspan="7">
            <?php
            echo $this->paginationControl($this->paginator, 'Sliding', 'pg_nav01.phtml');
            ?>
        </td>
    </tr>
</tfoot>
</table>
